var moveback={
    data(){
        return {                            
        }
    },
    methods:{
        cmd_moveback_do:function(){
            if(this.pages[this.activePageIndex].items.filter(item=>{return item.selected}).length != 1) return;            
            var item = JSON.parse(JSON.stringify(this.pages[this.activePageIndex].items.filter(e=>e.selected)[0]));
            if(item.idx === 0){
                console.warn('元素已在最后边,无法操作')
                return;
            }
            this.cmdo('records');
            var elements=[];
            elements.push(JSON.parse(JSON.stringify(item)));
            this.pages[this.activePageIndex].items.forEach((element,i)=>{
                if(item.idx != i){
                    elements.push(JSON.parse(JSON.stringify(element)));
                }
            });

            this.itemsInstanceUnChkSel(this.activePageIndex);
			this.clearSVG();
				
			this.pages[this.activePageIndex].items=[];							
			if(elements && elements.length>0){				
				for(var i=0;i<elements.length;i++){                    					
					this.renderItem(this.pages[this.activePageIndex],elements[i]);
				}				
            }
            item.idx=0;
            this.itemInstanceChecked(item);
        },
        cmd_moveback_active:function(selectCount){
            this.cmdActive['moveback']=selectCount===1 && this.pages[this.activePageIndex].items.filter(item=>{return item.selected})[0].idx !== 0;
        }
    }
}

export default moveback;
